package com.tt.plat8.bootstrap;

import com.tt.plat8.bootstrap.layout.MenusPanel;
import com.tt.plat8.commons.ui.Components;
import com.tt.plat8.theme.Plat8;
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.Reindeer;

/**
 * Created with IntelliJ IDEA.
 * UserBean: tangtao
 * Date: 14-1-20
 * Time: 上午10:15
 * To change this template use File | Settings | File Templates.
 */

@Theme(Plat8.THEME_NAME)
public class Application extends UI {

    private BorderLayout bodyLayout;

    private TabSheet tabs;


    private Layout getHeader() {
        HorizontalLayout header = new HorizontalLayout();
        header.setWidth("100%");
        header.setHeight("40px");
      //  header.setMargin(true);
        header.addComponent(Components.h2("OSGi Web Console"));

        header.addStyleName("navbar-inner");
        Label logoLabel = new Label();

        header.addComponent(logoLabel);
        return header;
    }

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        //To change body of implemented methods use File | Settings | File Templates.

       // VerticalLayout  mainWindow = new VerticalLayout ();

        VerticalLayout mainWindowLayout = new VerticalLayout();
        mainWindowLayout.setMargin(false);
        mainWindowLayout.setStyleName("blue");
      //  mainWindow.addComponent(mainWindowLayout);

        mainWindowLayout.setSizeFull();

        tabs = new TabSheet();
        tabs.setSizeFull();


        bodyLayout = new BorderLayout();
        bodyLayout.setSizeFull();

        bodyLayout.setMargin(true);
        bodyLayout.setSpacing(true);

        bodyLayout.addComponent(tabs, BorderLayout.Position.EAST);

        bodyLayout.addComponent(new MenusPanel(), BorderLayout.Position.WEST);

        //   mainWindowLayout.addComponent(getMenu());
        mainWindowLayout.addComponent(getHeader());
        mainWindowLayout.addComponent(bodyLayout);
        mainWindowLayout.setExpandRatio(bodyLayout, 1);

       setContent(mainWindowLayout);
    }
}
